var person = {
  point: {
    surplusCoin: 0,
    surplusPoints: 0
  },
  nav: 0,
  init: function () {
    this.renderRule()
    this.getPoint()
    this.renderPoint()
    this.getHistory()
    this.render()
  },
  renderRule: function () {
    try {
      var picture = page.data.bgs[7].typePicture[0].picPath3
      $("#container-0").append('<img class="rule" src="' + picture + '"/>');
    } catch (err) {
      console.log(err)
    }
  },
  getPoint: function () {
    var data = getPoints()
    if (!data.data) return
    this.point = data.data
  },
  renderPoint: function () {
    var html = ''
    html += '<div>'
    html += '<div>熊猫币：' + this.point.surplusCoin + '</div>'
    html += '<div>活跃度：' + this.point.surplusPoints + '</div>'
    html += '</div>'
    $('#point').html(html)
  },
  getHistory: function () {
    var data = getHistoryList()
    page.data.history = data.data
  },
  render: function () {
    var html = '';
    var data = page.data.history
    var l = data.length
    if (l > 0) {
      for (var i = 0; i < l; i++){
        var pictures = data[i].pictures;
        var len = pictures.length;
        var imgStr = ''
        for (var j = 0; j < len; j++) {
          if (pictures[j].ctype == 0) {
            imgStr = utils.toImgUrl(pictures[j].url)
            break;
          }
        }
        html += '<div id="list-' + i + '" class="item">'
        html += '<img src="' + imgStr + '"/>'
        html += '</div>'
      }
    } else {
      html = '<div class="empty">暂无数据</div>';
    }
    $('#list').html(html);
  },
  toggle: function () {
    for(var i = 0; i < $('.wrap-item').length; i++){
      if (i == this.nav){
        $($('.wrap-item')[i]).css("display","block");
      }else{
        $($('.wrap-item')[i]).css("display","none");
      }
    }
    //$('.wrap-item').eq(this.nav).show().siblings().css("display","none")
  }
}